#pragma once
#include "model.h"
#include "view.h"
#include "../gl/Application.h"

class LabApplication: public GlApplication {
private:
    Labirint * labirint;
    View * view;
protected:
    GlWindow * createWindow() override {
        auto * window = new GlWindow(200, 200, 800, 800, "Labirint");
        return window;
    }
    void pre_loop() override {
        this->init_timer(0, 100);
    }
public:
    void on_timer(int id) override {
        this->labirint->step();
        this->init_timer(0, 50);
        glutPostRedisplay();
    }

    LabApplication(int argc, char **argv) : GlApplication(argc, argv, true) {
        labirint = new Labirint(300, 200);
        //labirint->generate();
        view = new View(labirint);
    }

    ~LabApplication()  {
        delete labirint;
        delete view;
        delete labirint;
    }

    void draw() override {
        view->draw();
    }
};